#include "vector.hpp"

vector::vector(float a, float b, float c){
	e[0] = a;
	e[1] = b;
	e[2] = c;	
}

vector::vector(const vector &v){
	e[0] = v.e[0];
	e[1] = v.e[1];
	e[2] = v.e[2];
}

vector vector::operator=  (const vector& v){
	e[0] = v.e[0];
	e[1] = v.e[1];
	e[2] = v.e[2];
}

vector vector::operator+  (const vector& v){
	vector t;
	t.e[0] = e[0] + v.e[0];
	t.e[1] = e[0] + v.e[0];
	t.e[2] = e[0] + v.e[0];
	return t;
}

vector vector::operator+= (const vector& v){
	e[0] = e[0] + v.e[0];
	e[1] = e[0] + v.e[0];
	e[2] = e[0] + v.e[0];
	return (*this);
}

vector vector::operator-  (const vector& v){
	vector t;
	t.e[0] = e[0] - v.e[0];
	t.e[1] = e[0] - v.e[0];
	t.e[2] = e[0] - v.e[0];
	return t;
}

vector vector::operator-= (const vector& v){
	e[0] = e[0] - v.e[0];
	e[1] = e[0] - v.e[0];
	e[2] = e[0] - v.e[0];
	return (*this);
}
float  vector::operator*  (const vector& v){
	return e[0] * v.e[0] + e[1] * v.e[1] + e[2] * v.e[2];
}

bool vector::operator== (const vector& v){
	return (e[0] == v.e[0]) && (e[1] == v.e[1]) && (e[2] = v.e[2]);
}

bool vector::operator!= (const vector& v){
	if (e[0] != v.e[0]) return true;
	if (e[1] != v.e[1]) return true;
	if (e[2] != v.e[2]) return true;
	return false;

}

bool vector::operator<= (const vector& v){
	return !((*this) > v);
}

bool vector::operator<  (const vector& v){
	if (e[0] >= v.e[0]) return false;
	if (e[1] >= v.e[1]) return false;
	if (e[2] >= v.e[2]) return false;
	return true;
}

bool vector::operator>= (const vector& v){
	return !((*this) < v);
}

bool vector::operator>  (const vector& v){
	if (e[0] <= v.e[0]) return false;
	if (e[1] <= v.e[1]) return false;
	if (e[2] <= v.e[2]) return false;
	return true;	
}

void glVertex(const vector& V) {
	glVertex3fv(V.e);
}
